function initArticleModel(sequelize, DataTypes) {
    const Article = sequelize.define('article', {
        aid: {
            type: DataTypes.INTEGER,
            primaryKey: true,
            autoIncrement: true,
            field: 'aid'
        },
        uid: {
            type: DataTypes.INTEGER,
            allowNull: false,
            field: 'uid',
            comment: '用户id'
        },
        title: {
            type: DataTypes.STRING(255),
            allowNull: false,
            comment: '文章标题'
        },
        content: {
            type: DataTypes.TEXT,
            allowNull: false,
            comment: '文章内容'
        },
        summary: {
            type: DataTypes.TEXT,
            comment: '文章摘要'
        },
        coverImage: {
            type: DataTypes.STRING(500),
            field: 'coverImage',
            comment: '封面图片'
        },
        category: {
            type: DataTypes.STRING(100),
            comment: '文章分类'
        },
        tags: {
            type: DataTypes.STRING(255),
            comment: '文章标签，用逗号分隔'
        },
        viewCount: {
            type: DataTypes.INTEGER,
            defaultValue: 0,
            field: 'viewCount',
            comment: '浏览次数'
        },
        likeCount: {
            type: DataTypes.INTEGER,
            defaultValue: 0,
            field: 'likeCount',
            comment: '点赞次数'
        },
        status: {
            type: DataTypes.ENUM('draft', 'published', 'archived'),
            defaultValue: 'draft',
            comment: '文章状态'
        },
        publishAt: {
            type: DataTypes.DATE,
            field: 'publishAt',
            comment: '发布时间'
        }
    }, {
        tableName: 'article',
        timestamps: false
    });
    
    return Article;
}

module.exports = initArticleModel;